
#pragma once
#include <d2d1.h>
#include <vector>

namespace dxroids
{
   class CharacterRenderer
   {
   public:      

      enum Anchor { Left, Right, Center };

      CharacterRenderer();
      
      void DrawString(ID2D1RenderTarget * _target, ID2D1Brush * _brush,
         D2D1_POINT_2F const & _point, char * const _string, float _scale = 8.0f, Anchor _anchor = Left);

      float CharWidth(float _scale) const;
      float CharHeight(float _scale) const;

   private:
      typedef std::vector< std::pair<int, int> > point_list_type;

      void DrawLines(ID2D1RenderTarget * _target, ID2D1Brush * _brush, D2D1_POINT_2F const & _base, 
            point_list_type const & _points, float _scale);

   private:
      
      float character_width_;
      float character_height_;

      std::vector<D2D1_POINT_2F> all_points_;
      std::vector<point_list_type> line_lists_;
   };
}

inline float dxroids::CharacterRenderer::CharWidth(float _scale) const
{
   return character_width_ * _scale;
}

inline float dxroids::CharacterRenderer::CharHeight(float _scale) const
{
   return character_height_ * _scale;
}
